﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TXTD.Admin.Data.Entitys.System
{
    [Table("SYS_USER")]
    public class SysUser : BaseEntity
    {
        /// <summary>
        /// 用户id
        /// </summary>
        [Column("USER_ID")]
        public string UserId { get; set; } = Guid.NewGuid().ToString("N");

        /// <summary>
        /// 用户编号（登录账号）
        /// </summary>
        [Column("USER_CODE")]
        public string UserCode { get; set; }

        /// <summary>
        /// 用户名称（昵称）
        /// </summary>
        [Column("USER_NAME")]
        public string UserName { get; set; }

        /// <summary>
        /// 真实姓名
        /// </summary>
        [Column("REAL_NAME")]
        public string? RealName { get; set; }

        /// <summary>
        /// 邮箱地址
        /// </summary>
        [Column("EMAIL_ADDRESS")]
        public string? EmailAddress { get; set; }

        /// <summary>
        /// 手机号
        /// </summary>
        [Column("MOBILE_NUMBER")]
        public string? MobileNumber { get; set; }

        /// <summary>
        /// 是否启用
        /// </summary>
        [Column("ENABLED")]
        public bool Enabled { get; set; } = true;

        /// <summary>
        /// 用户密码key（加密）
        /// </summary>
        [Column("PASSWORD_KEY")]
        public string PasswordKey { get; set; }

        /// <summary>
        /// 用户密码（Md5）
        /// </summary>
        [Column("PASSWORD")]
        public string Password { get; set; }

        /// <summary>
        /// 最近一次登录时间
        /// </summary>
        [Column("LAST_LOGIN_TIME")]
        public DateTime? LastLoginTime { get; set; }
        /// <summary>
        /// 不在数据库中的字段
        /// </summary>
        [NotMapped]
        public List<string> RoleIds { get; set; }
    }
}